/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('eduembed', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CreateLabReservationRequest {
  accountId?: long(name='AccountId', description='This parameter is required.', example='16600'),
  endTime?: string(name='EndTime', description='This parameter is required.', example='2023-04-29 18:00:00'),
  labId?: long(name='LabId', description='This parameter is required.', example='875'),
  memberCount?: long(name='MemberCount', description='This parameter is required.', example='1'),
  startTime?: string(name='StartTime', description='This parameter is required.', example='2023-04-29 16:00:00'),
}

model CreateLabReservationResponseBody = {
  code?: string(name='Code', example='00000'),
  labReservation?: {
    id?: string(name='Id', example='10dbb36c-7047-41c7-92ee-bd24bcf45dca'),
  }(name='LabReservation'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='9ADC729B-...'),
  success?: boolean(name='Success', example='True'),
}

model CreateLabReservationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateLabReservationResponseBody(name='body'),
}

/**
 * @summary 创建实验预约
 *
 * @param request CreateLabReservationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateLabReservationResponse
 */
async function createLabReservationWithOptions(request: CreateLabReservationRequest, runtime: Util.RuntimeOptions): CreateLabReservationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountId)) {
    body['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.endTime)) {
    body['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.labId)) {
    body['LabId'] = request.labId;
  }
  if (!Util.isUnset(request.memberCount)) {
    body['MemberCount'] = request.memberCount;
  }
  if (!Util.isUnset(request.startTime)) {
    body['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateLabReservation',
    version = '2024-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建实验预约
 *
 * @param request CreateLabReservationRequest
 * @return CreateLabReservationResponse
 */
async function createLabReservation(request: CreateLabReservationRequest): CreateLabReservationResponse {
  var runtime = new Util.RuntimeOptions{};
  return createLabReservationWithOptions(request, runtime);
}

model CreateLabSessionRequest {
  accountId?: long(name='AccountId', description='This parameter is required.', example='-'),
  labId?: long(name='LabId', description='This parameter is required.', example='875'),
  ramAccountId?: long(name='RamAccountId', description='This parameter is required.', example='-'),
}

model CreateLabSessionResponseBody = {
  code?: string(name='Code', example='00000'),
  labSession?: {
    id?: string(name='Id', example='875'),
    url?: string(name='Url', example='-'),
  }(name='LabSession'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='9ADC729B-...'),
  success?: boolean(name='Success', example='True'),
}

model CreateLabSessionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateLabSessionResponseBody(name='body'),
}

/**
 * @summary 创建实验会话
 *
 * @param request CreateLabSessionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateLabSessionResponse
 */
async function createLabSessionWithOptions(request: CreateLabSessionRequest, runtime: Util.RuntimeOptions): CreateLabSessionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountId)) {
    body['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.labId)) {
    body['LabId'] = request.labId;
  }
  if (!Util.isUnset(request.ramAccountId)) {
    body['RamAccountId'] = request.ramAccountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateLabSession',
    version = '2024-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建实验会话
 *
 * @param request CreateLabSessionRequest
 * @return CreateLabSessionResponse
 */
async function createLabSession(request: CreateLabSessionRequest): CreateLabSessionResponse {
  var runtime = new Util.RuntimeOptions{};
  return createLabSessionWithOptions(request, runtime);
}

model DescribeLabRequest {
  labId?: long(name='LabId', description='This parameter is required.', example='875'),
}

model DescribeLabResponseBody = {
  code?: string(name='Code', example='00000'),
  lab?: {
    duration?: long(name='Duration', example='10'),
    id?: long(name='Id', example='875'),
    introduction?: string(name='Introduction'),
    subTitle?: string(name='SubTitle', example='-'),
    title?: string(name='Title'),
  }(name='Lab'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='9ADC729B-...'),
  success?: boolean(name='Success', example='True'),
}

model DescribeLabResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeLabResponseBody(name='body'),
}

/**
 * @summary 查看实验详情
 *
 * @param request DescribeLabRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeLabResponse
 */
async function describeLabWithOptions(request: DescribeLabRequest, runtime: Util.RuntimeOptions): DescribeLabResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeLab',
    version = '2024-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查看实验详情
 *
 * @param request DescribeLabRequest
 * @return DescribeLabResponse
 */
async function describeLab(request: DescribeLabRequest): DescribeLabResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeLabWithOptions(request, runtime);
}

model DescribeLabReservationRequest {
  accountId?: long(name='AccountId'),
  labReservationId?: string(name='LabReservationId', description='This parameter is required.', example='1'),
}

model DescribeLabReservationResponseBody = {
  code?: string(name='Code', example='00000'),
  labReservation?: {
    accountId?: long(name='AccountId'),
    endTime?: string(name='EndTime'),
    id?: string(name='Id', example='1'),
    memberCount?: long(name='MemberCount'),
    startTime?: string(name='StartTime'),
  }(name='LabReservation'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='9ADC729B-...'),
  success?: boolean(name='Success', example='True'),
}

model DescribeLabReservationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeLabReservationResponseBody(name='body'),
}

/**
 * @summary 查询实验预约
 *
 * @param request DescribeLabReservationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeLabReservationResponse
 */
async function describeLabReservationWithOptions(request: DescribeLabReservationRequest, runtime: Util.RuntimeOptions): DescribeLabReservationResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeLabReservation',
    version = '2024-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询实验预约
 *
 * @param request DescribeLabReservationRequest
 * @return DescribeLabReservationResponse
 */
async function describeLabReservation(request: DescribeLabReservationRequest): DescribeLabReservationResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeLabReservationWithOptions(request, runtime);
}

model DescribeLabSessionRequest {
  accountId?: long(name='AccountId', description='This parameter is required.', example='-'),
  labSessionId?: string(name='LabSessionId', description='This parameter is required.', example='1'),
  ramAccountId?: long(name='RamAccountId', description='This parameter is required.', example='-'),
}

model DescribeLabSessionResponseBody = {
  code?: string(name='Code', example='00000'),
  labSession?: {
    createTime?: string(name='CreateTime', example='2023-05-05 15:01:59'),
    finished?: boolean(name='Finished', example='False'),
    id?: string(name='Id', example='838'),
    labId?: long(name='LabId', example='875'),
    url?: string(name='Url', example='-'),
  }(name='LabSession'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='9ADC729B-...'),
  success?: boolean(name='Success', example='True'),
}

model DescribeLabSessionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeLabSessionResponseBody(name='body'),
}

/**
 * @summary 查看实验会话信息
 *
 * @param request DescribeLabSessionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeLabSessionResponse
 */
async function describeLabSessionWithOptions(request: DescribeLabSessionRequest, runtime: Util.RuntimeOptions): DescribeLabSessionResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeLabSession',
    version = '2024-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查看实验会话信息
 *
 * @param request DescribeLabSessionRequest
 * @return DescribeLabSessionResponse
 */
async function describeLabSession(request: DescribeLabSessionRequest): DescribeLabSessionResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeLabSessionWithOptions(request, runtime);
}

model PageListLabReservationsRequest {
  accountId?: long(name='AccountId'),
  page?: long(name='Page', example='1'),
  pageSize?: long(name='PageSize', example='20'),
}

model PageListLabReservationsResponseBody = {
  code?: string(name='Code', example='00000'),
  labReservations?: [ 
    {
      accountId?: long(name='AccountId', example='-'),
      endTime?: string(name='EndTime', example='2023-05-04 09:25:41'),
      id?: string(name='Id', example='552'),
      memberCount?: long(name='MemberCount', example='1'),
      startTime?: string(name='StartTime', example='2023-05-04 07:25:41'),
    }
  ](name='LabReservations'),
  message?: string(name='Message', example='success'),
  page?: long(name='Page', example='1'),
  pageSize?: long(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='9ADC729B-...'),
  success?: boolean(name='Success', example='True'),
  totalCount?: long(name='TotalCount', example='32'),
}

model PageListLabReservationsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PageListLabReservationsResponseBody(name='body'),
}

/**
 * @summary 分页查询实验预约
 *
 * @param request PageListLabReservationsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return PageListLabReservationsResponse
 */
async function pageListLabReservationsWithOptions(request: PageListLabReservationsRequest, runtime: Util.RuntimeOptions): PageListLabReservationsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PageListLabReservations',
    version = '2024-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 分页查询实验预约
 *
 * @param request PageListLabReservationsRequest
 * @return PageListLabReservationsResponse
 */
async function pageListLabReservations(request: PageListLabReservationsRequest): PageListLabReservationsResponse {
  var runtime = new Util.RuntimeOptions{};
  return pageListLabReservationsWithOptions(request, runtime);
}

model PageListLabSessionsRequest {
  finished?: boolean(name='Finished'),
  labId?: long(name='LabId'),
  page?: long(name='Page', example='1'),
  pageSize?: long(name='PageSize', example='20'),
  ramAccountId?: long(name='RamAccountId'),
}

model PageListLabSessionsResponseBody = {
  code?: string(name='Code', example='00000'),
  labSessions?: [ 
    {
      createTime?: string(name='CreateTime', example='2023-06-24 18:27:25'),
      finished?: boolean(name='Finished', example='False'),
      id?: string(name='Id', example='10334'),
      labId?: long(name='LabId', example='875'),
      url?: string(name='Url', example='-'),
    }
  ](name='LabSessions'),
  message?: string(name='Message', example='success'),
  page?: long(name='Page', example='1'),
  pageSize?: long(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='9ADC729B-...'),
  success?: boolean(name='Success', example='True'),
  totalCount?: long(name='TotalCount', example='12'),
}

model PageListLabSessionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PageListLabSessionsResponseBody(name='body'),
}

/**
 * @summary 分页查询实验会话
 *
 * @param request PageListLabSessionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return PageListLabSessionsResponse
 */
async function pageListLabSessionsWithOptions(request: PageListLabSessionsRequest, runtime: Util.RuntimeOptions): PageListLabSessionsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PageListLabSessions',
    version = '2024-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 分页查询实验会话
 *
 * @param request PageListLabSessionsRequest
 * @return PageListLabSessionsResponse
 */
async function pageListLabSessions(request: PageListLabSessionsRequest): PageListLabSessionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return pageListLabSessionsWithOptions(request, runtime);
}

model PageListLabsRequest {
  id?: [ long ](name='Id'),
  page?: long(name='Page', example='1'),
  pageSize?: long(name='PageSize', example='20'),
}

model PageListLabsResponseBody = {
  code?: string(name='Code', example='00000'),
  labs?: [ 
    {
      duration?: long(name='Duration', example='1'),
      id?: long(name='Id', example='981'),
      introduction?: string(name='Introduction'),
      subTitle?: string(name='SubTitle', example='-'),
      title?: string(name='Title'),
    }
  ](name='Labs'),
  message?: string(name='Message', example='success'),
  page?: long(name='Page', example='1'),
  pageSize?: long(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='9ADC729B-...'),
  success?: boolean(name='Success', example='True'),
  totalCount?: long(name='TotalCount', example='6'),
}

model PageListLabsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PageListLabsResponseBody(name='body'),
}

/**
 * @summary 分页查询实验
 *
 * @param request PageListLabsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return PageListLabsResponse
 */
async function pageListLabsWithOptions(request: PageListLabsRequest, runtime: Util.RuntimeOptions): PageListLabsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PageListLabs',
    version = '2024-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 分页查询实验
 *
 * @param request PageListLabsRequest
 * @return PageListLabsResponse
 */
async function pageListLabs(request: PageListLabsRequest): PageListLabsResponse {
  var runtime = new Util.RuntimeOptions{};
  return pageListLabsWithOptions(request, runtime);
}

model RemoveLabReservationRequest {
  accountId?: long(name='AccountId'),
  labReservationId?: string(name='LabReservationId', description='This parameter is required.', example='1'),
}

model RemoveLabReservationResponseBody = {
  code?: string(name='Code', example='00000'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='9ADC729B-...'),
  result?: boolean(name='Result', example='True'),
  success?: boolean(name='Success', example='True'),
}

model RemoveLabReservationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RemoveLabReservationResponseBody(name='body'),
}

/**
 * @summary 移除实验预约
 *
 * @param request RemoveLabReservationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RemoveLabReservationResponse
 */
async function removeLabReservationWithOptions(request: RemoveLabReservationRequest, runtime: Util.RuntimeOptions): RemoveLabReservationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountId)) {
    body['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.labReservationId)) {
    body['LabReservationId'] = request.labReservationId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RemoveLabReservation',
    version = '2024-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 移除实验预约
 *
 * @param request RemoveLabReservationRequest
 * @return RemoveLabReservationResponse
 */
async function removeLabReservation(request: RemoveLabReservationRequest): RemoveLabReservationResponse {
  var runtime = new Util.RuntimeOptions{};
  return removeLabReservationWithOptions(request, runtime);
}

